package com.ebao.po.user;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import com.ebao.constants.UserType;

/**
 * @desc 评论/回复 说说
 * @author snow
 * @date 2012-7-10
 */
@Entity
@Table(name = "T_Talk_Comment")
public class TTalkComment implements Serializable {

	private static final long serialVersionUID = -7655992603479942910L;
	
	private Long id;
	private TTalk talk;				// 评论的说说
	private UserType userType;		// 回复者类型user/doctor
	private String referId;			// 回复者Id
	private String content;			// 评论的内容 
	private String commentDate;		// 评论日期
	private boolean isRoot;			// 是否根评论
	private TTalkComment parent;	// 父级评论

	@Id
	@GeneratedValue
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@ManyToOne(optional = false, targetEntity = TTalk.class)
	@JoinColumn(name = "talk_id")
	public TTalk getTalk() {
		return talk;
	}

	public void setTalk(TTalk talk) {
		this.talk = talk;
	}

	public UserType getUserType() {
		return userType;
	}

	public void setUserType(UserType userType) {
		this.userType = userType;
	}

	public String getReferId() {
		return referId;
	}

	public void setReferId(String referId) {
		this.referId = referId;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	@Column(length = 19)
	public String getCommentDate() {
		return commentDate;
	}

	public void setCommentDate(String commentDate) {
		this.commentDate = commentDate;
	}

	public boolean isRoot() {
		return isRoot;
	}

	public void setRoot(boolean isRoot) {
		this.isRoot = isRoot;
	}

	@OneToOne(optional = true, targetEntity = TTalkComment.class)
	@JoinColumn(name = "parent_id")
	public TTalkComment getParent() {
		return parent;
	}

	public void setParent(TTalkComment parent) {
		this.parent = parent;
	}

}
